package com.zzyl.task;

import com.zzyl.service.AlertRuleService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

@Slf4j
@Component
public class AlarmTask {

    @Autowired
    private AlertRuleService alertRuleService;

    /**
     * 每月 每天 每小时的 每分钟执行任务
     */
    @Scheduled(cron = "0 * * * * ?")
    public void alarmTask() {
        log.info("报警任务开启");
        alertRuleService.alarmAction();
        log.info("报警任务结束");
    }
}
